﻿<!-- 继承公共文件 -->
<extend name="./Application/Admin/view/layout.html" />



      <block name="mid">
   
<div class="panel panel-danger">

                        <div class="panel-heading">
                           添加员工
                        </div>
                        <div class="panel-body">
                            <form id="signupForm" role="form" action="" method="post" enctype="multipart/form-data">
                                         

                                 <div class="form-group">
                                            <label>姓名</label>
                                            <input type="text" class="form-control" name="username">
                                            
                                    
                                        </div>
                                            <div class="form-group">
                                            <label>密码</label>
                                            <input type="password" name="password" class="form-control">
                                    
                                        </div>
                                <div class="form-group">
                                            <label>确认密码</label>
                                            <input id="cpassword" type="password" name="cpassword" class="form-control">
                                    
                                        </div>
                                 <div class="form-group">
                                            <label>邮箱</label>
                                            <input type="text" class="form-control" name="email">
                                    
                                        </div>
                                 <div class="form-group">
                                            <label>年龄</label>
                                            <input type="text" class="form-control" name="age">
                                    
                                        </div>
                                 <div class="form-group">
                                            <label>QQ</label>
                                            <input type="text" class="form-control" name="QQ">
                                    
                                        </div>
                                  <div class="form-group">
                                            <label>所属角色 ：</label>
                                            <select name="group_id">
                                            <option>请选择角色</option>
                                           <foreach name="group" item="vo">
                                            <option value="{$vo.id}">{$vo.title}</option>
                                          </foreach>

                                            </select>
                                        </div>
                                 
                                 <div class="form-group">
                                            <label>地址</label>
                                            <input type="text" class="form-control" name="adrees">
                                    
                                        </div>
                                 <!--  <div class="form-group">
                                            <label>所属角色 ：</label>
                                            <select name="role">
                                            <option value="0">请选择位置</option>
                                            <option value="1">头部</option>
                                            <option value="2">中间</option>
                                            <option value="3">底部</option>
                                            <option value="">无</option>

                                            </select>
                                        </div> -->
                                <div class="form-group">
                                            <label>手机号</label>
                                            <input type="text" class="form-control tel" name="tel">
                                            <label>短信验证码</label>
                                            <input type="button" name="send"  id="code" value="发送验证码">
                                             <input type="text" name="msg">
                                    
                                        </div>
                               
                                 <div class="form-group">
                                             <label>性别 ：</label>

                                           <label> <input type="radio" name="sex" value="1"> 男</label>

                                            <label> <input type="radio" name="sex" value="0"> 女</label>
                                            <input type="hidden" name="">
                                            
                                        </div>
                               
                                 <div class="form-group">
                                            <label>头像：</label>
                                            <input type="file" class="form-control" name="file" multiple>
                                    
                                        </div>
                                 
                                 
                                        <button class="btn btn-info" type="submit">确定 </button>

                                    </form>
                            </div>
                        </div>




<block name="js">


<script type="text/javascript" src="__ADMIN__assets/js/jquery-3.0.0.min.js"></script>
<script type="text/javascript">
$(function(){

     

    $('.text-center i').click(function(){
      var icon = $(this).text();
      $('.icon').val(icon);


    })



})



</script>

</block>

<block name="js">
<script  src="__ADMIN__assets/js/jquery.validate.min.js"></script>
<script type="text/javascript">

$(function(){

// alert(1111)
// 在键盘按下并释放及提交后验证提交表单
  $("#signupForm").validate({
       // debug:true,//只验证，不提交
       // 验证规则
        rules: {
            // 'username':'required',  //必填验证 
            'username': {
                required:true,//必填
                maxlength:10,//最多10位
                minlength:4,//至少4位
                },
            'password':{
                required:true,//必填
                equalTo:"#cpassword",//值相同

            },
            'sex':'required',
        },
        // 错误信息描述
        messages: {

            // username:'请输入帐号',
         
          username: {
            required: "请输入用户名",
            maxlength:"用户名最多10位",
            minlength: "用户名至少4位",
             },
          password:{
            required: "请输入密码",
            equalTo:"密码不一致",

         },
         sex:'请选择性别',
       },
       errorClass:'error',
    })
})


// 验证码计时器
var s=5;
var time=0;
$('#code').click(function(){
 
   var code= $(this);
   var tel = $('.tel').val();
   // alert(tel);

$.ajax({
     url:"{:U('admin/ajax/send_sms')}",
     type:'post',
     data:{
      'tel':tel,
     },
     success:function(code){
      // alert(code);
      if(code>0){
        alert( '验证码发送成功');
      }else{
        alert('验证码发送失败请稍候重试');
      }
     },


   })
time = setInterval(function(){

if(s>0){
    var txt = s+'s后重新发送';
    
    code.val(txt);
   code.prop('disabled',true);
   s--;
   
}else{
    s=5;
     var txt = '发送验证码';
    code.val(txt);
    code.prop('disabled',false);

    clearInterval(time);
}

  },1000);
    


})





</script>

</block>











